This is based only on my knowledge and experience with automatic transmissions, not on automatic transmissions in the 300zx. What you describe sounds like a problem I had once - the cause was particles in the transmission pan that get pulled up into the suction screen/filter of the transmission. When this happens a loss of fluid pressure occurs and the transmission does exactly what you describe. When you turn off the motor the suction is released and the particles fall back down into the pan, which is why the transmssion works again (briefly) when the motor is restarted.
I don't know what would cause the particles in the fluid - usually it's not good because it means something has come apart or broken down inside the transmission. And, this whole concept may have nothing to do with your car - just an idea.
If it was me I would pull the pan off the transmission and see what it looks like. You won't be out much and it will hopefully tell you your next step.